#pragma once
// MESSAGE XAP_CAMERA_TARGET_INFO PACKING

#define MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO 20102


typedef struct __mavlink_xap_camera_target_info_t {
 uint32_t time_boot_ms; /*< [ms] Timestamp (milliseconds since system boot)*/
 uint32_t x_offset; /*<   Target left position in frame. */
 uint32_t y_offset; /*<   Target top position in frame. */
 uint32_t height; /*<   Target height in frame. */
 uint32_t width; /*<   Target width in frame. */
 uint8_t targetID; /*<   Target ID. */
 uint8_t do_rectify; /*<   The sign of based raw frame. */
 uint8_t isTarget; /*<   The sign of target. */
} mavlink_xap_camera_target_info_t;

#define MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN 23
#define MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN 23
#define MAVLINK_MSG_ID_20102_LEN 23
#define MAVLINK_MSG_ID_20102_MIN_LEN 23

#define MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC 236
#define MAVLINK_MSG_ID_20102_CRC 236



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_XAP_CAMERA_TARGET_INFO { \
    20102, \
    "XAP_CAMERA_TARGET_INFO", \
    8, \
    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_xap_camera_target_info_t, time_boot_ms) }, \
         { "targetID", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_xap_camera_target_info_t, targetID) }, \
         { "x_offset", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_xap_camera_target_info_t, x_offset) }, \
         { "y_offset", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_xap_camera_target_info_t, y_offset) }, \
         { "height", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_xap_camera_target_info_t, height) }, \
         { "width", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_xap_camera_target_info_t, width) }, \
         { "do_rectify", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_xap_camera_target_info_t, do_rectify) }, \
         { "isTarget", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_xap_camera_target_info_t, isTarget) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_XAP_CAMERA_TARGET_INFO { \
    "XAP_CAMERA_TARGET_INFO", \
    8, \
    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_xap_camera_target_info_t, time_boot_ms) }, \
         { "targetID", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_xap_camera_target_info_t, targetID) }, \
         { "x_offset", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_xap_camera_target_info_t, x_offset) }, \
         { "y_offset", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_xap_camera_target_info_t, y_offset) }, \
         { "height", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_xap_camera_target_info_t, height) }, \
         { "width", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_xap_camera_target_info_t, width) }, \
         { "do_rectify", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_xap_camera_target_info_t, do_rectify) }, \
         { "isTarget", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_xap_camera_target_info_t, isTarget) }, \
         } \
}
#endif

/**
 * @brief Pack a xap_camera_target_info message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param targetID   Target ID. 
 * @param x_offset   Target left position in frame. 
 * @param y_offset   Target top position in frame. 
 * @param height   Target height in frame. 
 * @param width   Target width in frame. 
 * @param do_rectify   The sign of based raw frame. 
 * @param isTarget   The sign of target. 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_xap_camera_target_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               uint32_t time_boot_ms, uint8_t targetID, uint32_t x_offset, uint32_t y_offset, uint32_t height, uint32_t width, uint8_t do_rectify, uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN];
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_uint32_t(buf, 4, x_offset);
    _mav_put_uint32_t(buf, 8, y_offset);
    _mav_put_uint32_t(buf, 12, height);
    _mav_put_uint32_t(buf, 16, width);
    _mav_put_uint8_t(buf, 20, targetID);
    _mav_put_uint8_t(buf, 21, do_rectify);
    _mav_put_uint8_t(buf, 22, isTarget);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN);
#else
    mavlink_xap_camera_target_info_t packet;
    packet.time_boot_ms = time_boot_ms;
    packet.x_offset = x_offset;
    packet.y_offset = y_offset;
    packet.height = height;
    packet.width = width;
    packet.targetID = targetID;
    packet.do_rectify = do_rectify;
    packet.isTarget = isTarget;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC);
}

/**
 * @brief Pack a xap_camera_target_info message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param targetID   Target ID. 
 * @param x_offset   Target left position in frame. 
 * @param y_offset   Target top position in frame. 
 * @param height   Target height in frame. 
 * @param width   Target width in frame. 
 * @param do_rectify   The sign of based raw frame. 
 * @param isTarget   The sign of target. 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_xap_camera_target_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   uint32_t time_boot_ms,uint8_t targetID,uint32_t x_offset,uint32_t y_offset,uint32_t height,uint32_t width,uint8_t do_rectify,uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN];
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_uint32_t(buf, 4, x_offset);
    _mav_put_uint32_t(buf, 8, y_offset);
    _mav_put_uint32_t(buf, 12, height);
    _mav_put_uint32_t(buf, 16, width);
    _mav_put_uint8_t(buf, 20, targetID);
    _mav_put_uint8_t(buf, 21, do_rectify);
    _mav_put_uint8_t(buf, 22, isTarget);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN);
#else
    mavlink_xap_camera_target_info_t packet;
    packet.time_boot_ms = time_boot_ms;
    packet.x_offset = x_offset;
    packet.y_offset = y_offset;
    packet.height = height;
    packet.width = width;
    packet.targetID = targetID;
    packet.do_rectify = do_rectify;
    packet.isTarget = isTarget;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC);
}

/**
 * @brief Encode a xap_camera_target_info struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param xap_camera_target_info C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_xap_camera_target_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_xap_camera_target_info_t* xap_camera_target_info)
{
    return mavlink_msg_xap_camera_target_info_pack(system_id, component_id, msg, xap_camera_target_info->time_boot_ms, xap_camera_target_info->targetID, xap_camera_target_info->x_offset, xap_camera_target_info->y_offset, xap_camera_target_info->height, xap_camera_target_info->width, xap_camera_target_info->do_rectify, xap_camera_target_info->isTarget);
}

/**
 * @brief Encode a xap_camera_target_info struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param xap_camera_target_info C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_xap_camera_target_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_xap_camera_target_info_t* xap_camera_target_info)
{
    return mavlink_msg_xap_camera_target_info_pack_chan(system_id, component_id, chan, msg, xap_camera_target_info->time_boot_ms, xap_camera_target_info->targetID, xap_camera_target_info->x_offset, xap_camera_target_info->y_offset, xap_camera_target_info->height, xap_camera_target_info->width, xap_camera_target_info->do_rectify, xap_camera_target_info->isTarget);
}

/**
 * @brief Send a xap_camera_target_info message
 * @param chan MAVLink channel to send the message
 *
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param targetID   Target ID. 
 * @param x_offset   Target left position in frame. 
 * @param y_offset   Target top position in frame. 
 * @param height   Target height in frame. 
 * @param width   Target width in frame. 
 * @param do_rectify   The sign of based raw frame. 
 * @param isTarget   The sign of target. 
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_xap_camera_target_info_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t targetID, uint32_t x_offset, uint32_t y_offset, uint32_t height, uint32_t width, uint8_t do_rectify, uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN];
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_uint32_t(buf, 4, x_offset);
    _mav_put_uint32_t(buf, 8, y_offset);
    _mav_put_uint32_t(buf, 12, height);
    _mav_put_uint32_t(buf, 16, width);
    _mav_put_uint8_t(buf, 20, targetID);
    _mav_put_uint8_t(buf, 21, do_rectify);
    _mav_put_uint8_t(buf, 22, isTarget);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO, buf, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC);
#else
    mavlink_xap_camera_target_info_t packet;
    packet.time_boot_ms = time_boot_ms;
    packet.x_offset = x_offset;
    packet.y_offset = y_offset;
    packet.height = height;
    packet.width = width;
    packet.targetID = targetID;
    packet.do_rectify = do_rectify;
    packet.isTarget = isTarget;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO, (const char *)&packet, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC);
#endif
}

/**
 * @brief Send a xap_camera_target_info message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_xap_camera_target_info_send_struct(mavlink_channel_t chan, const mavlink_xap_camera_target_info_t* xap_camera_target_info)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_xap_camera_target_info_send(chan, xap_camera_target_info->time_boot_ms, xap_camera_target_info->targetID, xap_camera_target_info->x_offset, xap_camera_target_info->y_offset, xap_camera_target_info->height, xap_camera_target_info->width, xap_camera_target_info->do_rectify, xap_camera_target_info->isTarget);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO, (const char *)xap_camera_target_info, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC);
#endif
}

#if MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_xap_camera_target_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t time_boot_ms, uint8_t targetID, uint32_t x_offset, uint32_t y_offset, uint32_t height, uint32_t width, uint8_t do_rectify, uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_uint32_t(buf, 4, x_offset);
    _mav_put_uint32_t(buf, 8, y_offset);
    _mav_put_uint32_t(buf, 12, height);
    _mav_put_uint32_t(buf, 16, width);
    _mav_put_uint8_t(buf, 20, targetID);
    _mav_put_uint8_t(buf, 21, do_rectify);
    _mav_put_uint8_t(buf, 22, isTarget);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO, buf, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC);
#else
    mavlink_xap_camera_target_info_t *packet = (mavlink_xap_camera_target_info_t *)msgbuf;
    packet->time_boot_ms = time_boot_ms;
    packet->x_offset = x_offset;
    packet->y_offset = y_offset;
    packet->height = height;
    packet->width = width;
    packet->targetID = targetID;
    packet->do_rectify = do_rectify;
    packet->isTarget = isTarget;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO, (const char *)packet, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_MIN_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_CRC);
#endif
}
#endif

#endif

// MESSAGE XAP_CAMERA_TARGET_INFO UNPACKING


/**
 * @brief Get field time_boot_ms from xap_camera_target_info message
 *
 * @return [ms] Timestamp (milliseconds since system boot)
 */
static inline uint32_t mavlink_msg_xap_camera_target_info_get_time_boot_ms(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  0);
}

/**
 * @brief Get field targetID from xap_camera_target_info message
 *
 * @return   Target ID. 
 */
static inline uint8_t mavlink_msg_xap_camera_target_info_get_targetID(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  20);
}

/**
 * @brief Get field x_offset from xap_camera_target_info message
 *
 * @return   Target left position in frame. 
 */
static inline uint32_t mavlink_msg_xap_camera_target_info_get_x_offset(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  4);
}

/**
 * @brief Get field y_offset from xap_camera_target_info message
 *
 * @return   Target top position in frame. 
 */
static inline uint32_t mavlink_msg_xap_camera_target_info_get_y_offset(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  8);
}

/**
 * @brief Get field height from xap_camera_target_info message
 *
 * @return   Target height in frame. 
 */
static inline uint32_t mavlink_msg_xap_camera_target_info_get_height(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  12);
}

/**
 * @brief Get field width from xap_camera_target_info message
 *
 * @return   Target width in frame. 
 */
static inline uint32_t mavlink_msg_xap_camera_target_info_get_width(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  16);
}

/**
 * @brief Get field do_rectify from xap_camera_target_info message
 *
 * @return   The sign of based raw frame. 
 */
static inline uint8_t mavlink_msg_xap_camera_target_info_get_do_rectify(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  21);
}

/**
 * @brief Get field isTarget from xap_camera_target_info message
 *
 * @return   The sign of target. 
 */
static inline uint8_t mavlink_msg_xap_camera_target_info_get_isTarget(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  22);
}

/**
 * @brief Decode a xap_camera_target_info message into a struct
 *
 * @param msg The message to decode
 * @param xap_camera_target_info C-struct to decode the message contents into
 */
static inline void mavlink_msg_xap_camera_target_info_decode(const mavlink_message_t* msg, mavlink_xap_camera_target_info_t* xap_camera_target_info)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    xap_camera_target_info->time_boot_ms = mavlink_msg_xap_camera_target_info_get_time_boot_ms(msg);
    xap_camera_target_info->x_offset = mavlink_msg_xap_camera_target_info_get_x_offset(msg);
    xap_camera_target_info->y_offset = mavlink_msg_xap_camera_target_info_get_y_offset(msg);
    xap_camera_target_info->height = mavlink_msg_xap_camera_target_info_get_height(msg);
    xap_camera_target_info->width = mavlink_msg_xap_camera_target_info_get_width(msg);
    xap_camera_target_info->targetID = mavlink_msg_xap_camera_target_info_get_targetID(msg);
    xap_camera_target_info->do_rectify = mavlink_msg_xap_camera_target_info_get_do_rectify(msg);
    xap_camera_target_info->isTarget = mavlink_msg_xap_camera_target_info_get_isTarget(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN? msg->len : MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN;
        memset(xap_camera_target_info, 0, MAVLINK_MSG_ID_XAP_CAMERA_TARGET_INFO_LEN);
    memcpy(xap_camera_target_info, _MAV_PAYLOAD(msg), len);
#endif
}
